package com.acme.bankapp.domain.bank;

import com.acme.bankapp.exception.bank.NotEnoughFundsException;

/**
 * Interface representing account functionality
 *
 * @author Gregory Sobko
 *
 */
public interface Account {



    /**
     * Deposits money on account. Amount should be positive
     * @param amount amount to deposit
     * @return balance after operation
     * @throws IllegalArgumentException on negative amount
     */
    double deposit(final double amount) throws IllegalArgumentException;

    /**
     * Withdraws money from account. Amount should be positive
     * @param amount amount to withdraw
     * @return balance after operation
     * @throws NotEnoughFundsException if we have not enough funds
     * @throws IllegalArgumentException on negative amount
     */
    double withdraw(final double amount) throws IllegalArgumentException, NotEnoughFundsException;

    /**
     * Returns maximum amount available for user
     * @return max amount to withdraw
     */
    double maximumAmountToWithdraw();

    /**
     * Returns Balance. Balance can be negative
     * @return actual balance
     */
    double getBalance();

    /**
     * Get owner client of account
     * @return client
     */
    Client getClient();

    /**
     * Sets owner of account. To assure integrity use com.acme.bankapp.service.bank.BankService.associateClientWithAccount
     * @see com.acme.bankapp.service.bank.BankService
     * @param client owner
     */
    void setClient(Client client);

    /**
     * Returns rounded balance
     * @return rounded balance
     */
    long getDecimalBalance();
}
